package com.wsoft.system.manager;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wsoft.system.entity.SysMemberFileEntity;
import com.wsoft.system.mapper.SysMemberFileMapper;
import com.wsoft.system.query.member.file.SysMemberFileListQuery;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Z001
 * @Date 2025-03-06 01:28:06
 */
@Service
public class SysMemberFileManager extends ServiceImpl<SysMemberFileMapper, SysMemberFileEntity> {


    /**
     * 查询列表
     * @param param
     * @return
     */
    public List<SysMemberFileEntity> list(SysMemberFileListQuery param){
        QueryWrapper<SysMemberFileEntity> query = new QueryWrapper<>();
        //搜索参数
        query.lambda().eq(StrUtil.isNotBlank(param.getType()),SysMemberFileEntity::getType,param.getType())
                .like(StrUtil.isNotBlank(param.getFileName()),SysMemberFileEntity::getFile,param.getFileName())
                .orderByAsc(SysMemberFileEntity::getSort);
        return super.list(query);
    }

    /**
     * 根据id查询
     * @param id
     * @return
     */
    public SysMemberFileEntity getById(Long id){
        return super.getById(id);
    }

    /**
     * 新增
     * @param entity
     * @return
     */
    @Override
    public boolean save(SysMemberFileEntity entity){
        return super.save(entity);
    }

    /**
     * 更新
     * @param entity
     * @return
     */
    @Override
    public boolean updateById(SysMemberFileEntity entity){
        return super.updateById(entity);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    public boolean removeById(Long id){
        return super.removeById(id);
    }
}
